package com.chengzhi.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.exception.ZuulException;
import org.springframework.stereotype.Component;

/**
 * @author ruanchengzhi
 * @description: zuulFilter
 * @date 2019/9/28 14:33
 */
@Component
public class FirstFilter extends ZuulFilter {

    /**
     * description filter 类型 pre route post error
     *
     * @param
     * @return java.lang.String
     * @author ruanchengzhi
     * @date 2019/9/28 14:35
     **/
    @Override
    public String filterType() {
        return "pre";
    }

    /**
     * description filter执行顺序
     *
     * @param
     * @return int
     * @author ruanchengzhi
     * @date 2019/9/28 14:35
     **/
    @Override
    public int filterOrder() {
        return 0;
    }

    /**
     * description filter是否执行
     *
     * @param
     * @return boolean
     * @author ruanchengzhi
     * @date 2019/9/28 14:36
     **/
    @Override
    public boolean shouldFilter() {
        return true;
    }

    /**
     * description filter核心逻辑
     *
     * @param
     * @return java.lang.Object
     * @author ruanchengzhi
     * @date 2019/9/28 14:36
     **/
    @Override
    public Object run() throws ZuulException {
        System.out.println("--------first filter---------");
        return null;
    }
}
